package com.wc.alorithm_blue_bridge._数学知识.约数.Q112循环;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.HashSet;
import java.util.StringTokenizer;

/**
 * @Author congge
 * @Date 2025/1/7 19:45
 * @description
 * https://www.lanqiao.cn/problems/18415/learning/?problem_list_id=31&page=1
 */
public class Main {
    /**
     * 思路：
     * 考察质因数分解,
     * 还有模拟除法
     */
    static FastReader sc = new FastReader();
    static PrintWriter out = new PrintWriter(System.out);
    static int n = 160, m = 113;
    static int[] a = new int[112];
    static HashSet<Integer> set = new HashSet<>();
    static int[] num = new int[10];

    public static void main(String[] args) {
        int idx = 0;
        // 模拟除法， 保存循环小数
        while (!set.contains(n)) {
            set.add(n);
            a[idx++] = n / m;
            n = n % m * 10;
        }
        // 质因数分解
        for (int j = 1, i = 0; j <= 227; i++, j++){
            if (i == 112) i = 0;
            int x = a[i];
            for (int k = 2; k * k <= x; k++) {
                if (x % k == 0) {
                    int s = 0;
                    while (x % k == 0) {
                        s++;
                        x /= k;
                    }
                    num[k] += s;
                }
            }
            if (x > 1) num[x]++;
        }
        int res = 1;
        // 求约数个数
        for (int i = 1; i < 10; i++) res = res * (num[i] + 1);
        out.println(res);
        out.flush();
    }
}

class FastReader {
    StringTokenizer st;
    BufferedReader br;

    FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    String nextLine() {
        String s = "";
        try {
            s = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return s;
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    // 是否由下一个
    boolean hasNext() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                String line = br.readLine();
                if (line == null)
                    return false;
                st = new StringTokenizer(line);
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return true;
    }
}

